package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.RoomBean;
import com.project.mapper.IRoomMapper;
import com.project.service.IRoomService;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class RoomImpl implements IRoomService {

    @Autowired
    private IRoomMapper mapper;

    @Override
    public void add(RoomBean roomBean) {
        mapper.add(roomBean);
    }

    @Override
    public void del(int id) {

        mapper.del(id);
    }

    @Override
    public void update(int id, int price) {

        mapper.update(id,price);
    }

    @Override
    public RoomBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public PageInfo<RoomBean> findByItem(int pageNo, String address, Integer startPrice, Integer endPrice) {
        PageHelper.startPage(pageNo,PAGESIZE);
        return PageInfo.of(mapper.findByItem(address,
                startPrice,endPrice));
    }


}
